//
//  ByHomeSectionView.m
//  caipiao_ios
//
//  Created by mc on 2018/10/29.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByHomeSectionView.h"

@implementation ByHomeSectionView

- (id)init{
    self = [super init];
    if (self) {
        self.backgroundColor = rgba(246, 246, 246, 1);
        
    }
    return self;
}

- (void)setType:(NSInteger)type{
    
    [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    _type = type;
    
    CGFloat width = 80;
    if (_type == 1) {
        width = 130;
    }
    UILabel *titleLabel = [[UILabel alloc] init];
    [self addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(15);
        make.bottom.equalTo(self).offset(-15);
        make.size.mas_equalTo(CGSizeMake(width, 20));
    }];
    titleLabel.font = FONT(17);
    titleLabel.textColor = BY_TEXT_COLOR;
    
    
    
    UILabel *line = [[UILabel alloc] init];
    [self addSubview:line];
    line.backgroundColor = rgba(172, 172, 172, 1);
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(titleLabel.mas_right).offset(0);
        make.centerY.equalTo(titleLabel.mas_centerY).offset(0);
        make.size.mas_equalTo(CGSizeMake(2, 13));
    }];
    
    UILabel *noteLabel = [[UILabel alloc] init];
    [self addSubview:noteLabel];
    [noteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(line.mas_right).offset(15);
        make.bottom.equalTo(titleLabel.mas_bottom).offset(0);
        make.right.equalTo(self).offset(-10);
        make.height.mas_equalTo(@15);
    }];
    noteLabel.font = FONT(13);
    noteLabel.textColor = rgba(172, 172, 172, 1);
    
    if (_type == 0) {
        titleLabel.text = @"爆款彩种";
        noteLabel.text = @"Lottery";
        
    }else if (_type == 1){
        titleLabel.text = @"数字彩快速投注";
        noteLabel.text = @"Betting";
    }
    
}


@end
